// Copyright (C) ZHENG Zhong <heavyzheng nospam-at gmail D0T com>
//
// $Id: test_utility.hpp 226 2008-09-12 17:56:02Z heavyzheng $
//

#ifndef ZZHENG_TEST_UTILITY_HPP_20080730__
#define ZZHENG_TEST_UTILITY_HPP_20080730__

#include <zzheng/test_config.hpp>

#ifdef ZZHENG_MSVC
#  pragma warning(push)
#  pragma warning(disable: 4127 4511 4512 4701)
#endif // ZZHENG_MSVC

#include <boost/lexical_cast.hpp>

#ifdef ZZHENG_MSVC
#  pragma warning(pop)
#endif // ZZHENG_MSVC

#include <string>

namespace zzheng {
namespace test {

    ////////////////////////////////////////////////////////////////////////////////////////////////
    // csv_record
    //

    class csv_record {

    public:

        explicit csv_record();

        // Use auto-generated copy constructor.
        // Use auto-generated copy assignment.
        // Use auto-generated destructor.

        void clear();

        const std::string& str() const;

        template<typename T>
        csv_record& operator<<(const T& field) {
            return add_field_(boost::lexical_cast<std::string>(field));
        }

    private:

        csv_record& add_field_(const std::string& field);

    private:

        std::string buffer_;
        bool        empty_;

    }; // class csv_record


} // namespace zzheng::test
} // namespace zzheng

#endif // ZZHENG_TEST_CSV_RECORD_HPP_20080730__


